package com.java.socket;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class OutStreamTest {
	public static void main(String[] args) {
		FileOutputStream fos=null;
		OutputStreamWriter osw=null;
		PrintWriter pw=null;
		try {
			fos=new FileOutputStream("./def.txt");
			osw=new OutputStreamWriter(fos,"UTF8");
			pw=new PrintWriter(osw);
			pw.println("lalala,la！");
			pw.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			if(pw!=null)pw.close();
			if(osw!=null)try{osw.close();}catch(IOException e){}
			if(fos!=null)try{fos.close();}catch(IOException e){}
		}
		
	}
}
